<?php

/**
 * 后台相关助手函数
 *
 * @author JiangJian <silverd@sohu.com>
 * @copyright 2011-2012 xiangle.com
 * $Id: CPanel.php 162 2012-11-09 04:04:30Z Jun.Lu.726@gmail.com $
 * @version    2012-02-20  ::  JiangJian  ::  Create File
 */
class Helper_CPanel
{

    /**
     * 生成状态切换链接
     *
     * @param string $url
     * @param int $id 对象ID
     * @param int $status 适合0/1状态切换
     * @return string
     */
    public static function ajaxStatusLink($url, $id, $status, $txtType = null)
    {
        switch ($txtType) {
            case 1:
                $statusTxts = array('下线', '上线');
                break;
            default:
                $statusTxts = array('冻结', '正常');
        }
        switch ($status) {
            case 1:
                return '<a class="status1" href="javascript:;" onclick="ajaxStatus(\'' . $url . '\', \'' . $id . '\', 0, this);" title="点击设为' . $statusTxts[0] . '"><u>' . $statusTxts[1] . '</u></a>';
                break;
            case 0:
                return '<a class="status0" href="javascript:;" onclick="ajaxStatus(\'' . $url . '\', \'' . $id . '\', 1, this);" title="点击设为' . $statusTxts[1] . '" style="color: #F00;"><u>' . $statusTxts[0] . '</u></a>';
                break;
            default:
                return '<span style="color:#D4D4D4">已删除</span>';
        }
    }

}